<template>
    <div>
        这是index组件内容
        <h2>parent----{{$store.state.count}}</h2>
        <child-1></child-1>
        <child-2 :child2Value.sync="count"></child-2>
        <el-button @click="addCount">增加</el-button>
        {{$store.state.count}}
        <el-button @click="setList">setList</el-button>
    </div>
</template>

<script>
import Child1 from './child1.vue'
import Child2 from './child2.vue'

export default {
    data(){
        return{
            count:0
        }
    },
    components:{
        Child1,
        Child2
    },
    methods:{
        addCount(){
            this.$store.commit('addCount')
        },
        setList(){
            this.$store.commit('setList','这是parent来的信息')
        }
    }
}
</script>